<?php

    require_once "comment/comment.php";
    require_once "server/Server.php";
    require_once "lib/MyAdodb.php";

    $conf=include "conf/conf.php";

	//获取请求ip
	$access_ip=$_SERVER['REMOTE_ADDR'];

	print_log("access_ip:$access_ip");

	//检查是否允许访问
	$ips=$conf["ACCEPT_IPS"];

	if(in_array($access_ip, $ips)){
		
		//根据请求路径，加载对应server，调用指定方法
		include_once("lib/Dispatcher.php");

		$dis=new Dispatcher();

		$dis->dispatch();

	}else{

		$data["code"]=400;
		$data["msg"]="refuse access for ip:$access_ip";

		header('Content-Type: application/json; charset=utf-8');		
		echo json_encode($data);
	}

